// request
import { getMyManuscriptList, articleAdd, articleAudit } from '@/api/provideEnd/myManuscript.js'

export default {
  methods: {
    async getMyManuscriptList(params) {
      this.tableLoading = true
      const res = await getMyManuscriptList(params)
      // console.log('getMyManuscriptList', res)
      const data = res.data.data || {}
      this.tableData = Object.freeze(data.data || [])
      this.pagination.total = data.count || 0
      this.tableLoading = false
    },

    async articleAdd(data) {
      const res = await articleAdd(data)
      const status = res.data.status
      if (status === 0) {
        this.$refs['modalUploadRef'].open_uploadScuuess()
        this.handleFormSubmit()
      } else {
        this.$refs['modalUploadRef'].open_uploadFailed()
        setTimeout(() => this.$refs['modalUploadRef'].close_uploadFailed(), 1200)
      }
    },

    async articleAudit(params) {
      const res = await articleAudit(params)
      const status = res.data.status
      if (status === 0) {
        this.$Message.success('操作成功')
        this.handleFormSubmit()
      } else {
        this.$Message.error('操作失败，请稍后再试')
      }
    },
  },

  mounted() {},
}
